package net.bxx2004.extand.commands;

import net.bxx2004.extand.manager.ConfigManager;
import net.bxx2004.extand.manager.MenuManager;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;

public class MenuOpen implements Listener {
    @EventHandler
    public void onOpenMenu(PlayerCommandPreprocessEvent event){
        try {
            if (event.getMessage().equalsIgnoreCase("/" + ConfigManager.getSetting().getString("OpenMenuCommand"))){
                event.setCancelled(true);
                MenuManager.open(event.getPlayer());
            }
        }catch (Exception e){e.printStackTrace();}
    }
}
